From: Bas Couwenberg Date: Sat, 15 Feb 2025 13:13:19 +0000 (+0000) Subject: Replace _FillValue by NC_FillValue for NetCDF 4.9.3. X-Git-Tag: archive/raspbian/9.5.2+dfsg2-4+rpi1~1^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=33d18d0a60073527ff4d58286d8a41ee0030a0f0;p=vtk9.git Replace _FillValue by NC_FillValue for NetCDF 4.9.3. Gbp-Pq: Name netcdf-4.9.3.patch --- diff --git a/IO/MINC/vtkMINC.h b/IO/MINC/vtkMINC.h index 8b33066e..e09abdf2 100644 --- a/IO/MINC/vtkMINC.h +++ b/IO/MINC/vtkMINC.h @@ -178,7 +178,7 @@ use it. #define MIvalid_range "valid_range" #define MIvalid_max "valid_max" #define MIvalid_min "valid_min" -#define MI_FillValue "_FillValue" +#define MI_FillValue "NC_FillValue" #define MItitle "title" #define MIhistory "history" diff --git a/IO/NetCDF/vtkNetCDFCFWriter.cxx b/IO/NetCDF/vtkNetCDFCFWriter.cxx index 659d7b6c..ae9d5198 100644 --- a/IO/NetCDF/vtkNetCDFCFWriter.cxx +++ b/IO/NetCDF/vtkNetCDFCFWriter.cxx @@ -442,7 +442,7 @@ public: status = NC_NOERR; if (std::string(arrayName).rfind("vtk", 0) > 0) { - // for an array that starts with vtk we don't specify _FillValue + // for an array that starts with vtk we don't specify NC_FillValue switch (vtkType) { case VTK_CHAR: @@ -451,34 +451,34 @@ public: if (fillValue != NC_FILL_INT) { unsigned char fillByte = fillValue; - status = nc_put_att(ncid, attributeid, "_FillValue", NC_BYTE, 1, &fillByte); + status = nc_put_att(ncid, attributeid, "NC_FillValue", NC_BYTE, 1, &fillByte); } break; case VTK_SHORT: if (fillValue != NC_FILL_SHORT) { short fillShort = fillValue; - status = nc_put_att_short(ncid, attributeid, "_FillValue", NC_SHORT, 1, &fillShort); + status = nc_put_att_short(ncid, attributeid, "NC_FillValue", NC_SHORT, 1, &fillShort); } break; case VTK_INT: if (fillValue != NC_FILL_INT) { - status = nc_put_att_int(ncid, attributeid, "_FillValue", NC_INT, 1, &fillValue); + status = nc_put_att_int(ncid, attributeid, "NC_FillValue", NC_INT, 1, &fillValue); } break; case VTK_FLOAT: if (fillValue != NC_FILL_INT) { float fillFloat = fillValue; - status = nc_put_att_float(ncid, attributeid, "_FillValue", NC_FLOAT, 1, &fillFloat); + status = nc_put_att_float(ncid, attributeid, "NC_FillValue", NC_FLOAT, 1, &fillFloat); } break; case VTK_DOUBLE: if (fillValue != NC_FILL_INT) { double fillDouble = fillValue; - status = nc_put_att_double(ncid, attributeid, "_FillValue", NC_DOUBLE, 1, &fillDouble); + status = nc_put_att_double(ncid, attributeid, "NC_FillValue", NC_DOUBLE, 1, &fillDouble); } break; default: @@ -489,7 +489,7 @@ public: if (status) { std::ostringstream ostr; - ostr << "Error nc_put_att_xxx " << arrayName << ":_FillValue: " << nc_strerror(status); + ostr << "Error nc_put_att_xxx " << arrayName << ":NC_FillValue: " << nc_strerror(status); throw std::runtime_error(ostr.str()); } } diff --git a/IO/NetCDF/vtkNetCDFReader.cxx b/IO/NetCDF/vtkNetCDFReader.cxx index aa47707c..d9a44aa8 100644 --- a/IO/NetCDF/vtkNetCDFReader.cxx +++ b/IO/NetCDF/vtkNetCDFReader.cxx @@ -867,7 +867,7 @@ int vtkNetCDFReader::LoadVariable(int ncFD, const char* varName, double time, vt // Check for a fill value. size_t attribLength; - if ((nc_inq_attlen(ncFD, varId, "_FillValue", &attribLength) == NC_NOERR) && (attribLength == 1)) + if ((nc_inq_attlen(ncFD, varId, "NC_FillValue", &attribLength) == NC_NOERR) && (attribLength == 1)) { if (this->ReplaceFillValueWithNan) { @@ -875,7 +875,7 @@ int vtkNetCDFReader::LoadVariable(int ncFD, const char* varName, double time, vt if (dataArray->GetDataType() == VTK_FLOAT) { float fillValue; - nc_get_att_float(ncFD, varId, "_FillValue", &fillValue); + nc_get_att_float(ncFD, varId, "NC_FillValue", &fillValue); std::replace(reinterpret_cast(dataArray->GetVoidPointer(0)), reinterpret_cast(dataArray->GetVoidPointer(dataArray->GetNumberOfTuples())), fillValue, static_cast(vtkMath::Nan())); @@ -883,7 +883,7 @@ int vtkNetCDFReader::LoadVariable(int ncFD, const char* varName, double time, vt else if (dataArray->GetDataType() == VTK_DOUBLE) { double fillValue; - nc_get_att_double(ncFD, varId, "_FillValue", &fillValue); + nc_get_att_double(ncFD, varId, "NC_FillValue", &fillValue); std::replace(reinterpret_cast(dataArray->GetVoidPointer(0)), reinterpret_cast(dataArray->GetVoidPointer(dataArray->GetNumberOfTuples())), fillValue, vtkMath::Nan()); diff --git a/IO/NetCDF/vtkNetCDFReader.h b/IO/NetCDF/vtkNetCDFReader.h index fedf0fb3..4feeaa9a 100644 --- a/IO/NetCDF/vtkNetCDFReader.h +++ b/IO/NetCDF/vtkNetCDFReader.h @@ -107,7 +107,7 @@ public: ///@{ /** - * If on, any float or double variable read that has a _FillValue attribute + * If on, any float or double variable read that has a NC_FillValue attribute * will have that fill value replaced with a not-a-number (NaN) value. The * advantage of setting these to NaN values is that, if implemented properly * by the system and careful math operations are used, they can implicitly be diff --git a/IO/NetCDF/vtkNetCDFUGRIDReader.cxx b/IO/NetCDF/vtkNetCDFUGRIDReader.cxx index 5b96d643..1b2c53ad 100644 --- a/IO/NetCDF/vtkNetCDFUGRIDReader.cxx +++ b/IO/NetCDF/vtkNetCDFUGRIDReader.cxx @@ -508,10 +508,10 @@ bool vtkNetCDFUGRIDReader::ParseHeader() if (this->NodesPerFace > 3) // may be mixed mesh { if (!this->CheckError( - nc_get_att(this->NcId, this->FaceVarId, "_FillValue", &this->FaceFillValue))) + nc_get_att(this->NcId, this->FaceVarId, "NC_FillValue", &this->FaceFillValue))) { - vtkErrorMacro("_FillValue attribute missing - The connectivity variable has to specify a " - "_FillValue attribute because it has more than 3 nodes per face"); + vtkErrorMacro("NC_FillValue attribute missing - The connectivity variable has to specify a " + "NC_FillValue attribute because it has more than 3 nodes per face"); return false; } } @@ -859,7 +859,7 @@ struct DataArrayExtractor if (replaceFill && (std::is_same::value || std::is_same::value)) { T fillValue{}; - if (nc_get_att(NcId, var, "_FillValue", &fillValue) != NC_NOERR) + if (nc_get_att(NcId, var, "NC_FillValue", &fillValue) != NC_NOERR) { vtkDebugWithObjectMacro(output, "No fill value defined"); return; diff --git a/IO/NetCDF/vtkNetCDFUGRIDReader.h b/IO/NetCDF/vtkNetCDFUGRIDReader.h index 7997370c..99559b86 100644 --- a/IO/NetCDF/vtkNetCDFUGRIDReader.h +++ b/IO/NetCDF/vtkNetCDFUGRIDReader.h @@ -76,7 +76,7 @@ public: ///@{ /** - * If on, any float or double variable read that has a _FillValue attribute + * If on, any float or double variable read that has a NC_FillValue attribute * will have that fill value replaced with a not-a-number (NaN) value. The * advantage of setting these to NaN values is that, if implemented properly * by the system and careful math operations are used, they can implicitly be diff --git a/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop.c b/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop.c index 2b661d31..69b5ed29 100644 --- a/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop.c +++ b/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop.c @@ -243,7 +243,7 @@ int ex_put_prop(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const c vals[0] = 0; /* fill value */ /* create attribute to cause variable to fill with zeros per routine spec */ - if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) { + if ((status = nc_put_att_longlong(exoid, propid, NC_FillValue, int_type, 1, vals)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to create property name fill attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); diff --git a/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop_names.c b/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop_names.c index 9d2223dc..98caea5a 100644 --- a/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop_names.c +++ b/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop_names.c @@ -172,7 +172,7 @@ int ex_put_prop_names(int exoid, ex_entity_type obj_type, int num_props, char ** /* create attribute to cause variable to fill with zeros per routine spec */ - if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) { + if ((status = nc_put_att_longlong(exoid, propid, NC_FillValue, int_type, 1, vals)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to create property name fill attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status);